package com.sc.nft.entity.dto;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sc.nft.entity.UserCoupons;
import com.sc.nft.enums.CouponsTypeEnum;
import com.sc.nft.enums.UserCouponsStatusEnum;
import com.sc.nft.util.Beans;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 用户优惠券DTO
 *
 * @author liGen
 * @version 1.0
 * @date 2023/12/7 5:10 下午
 */
@Data
public class UserCouponsDTO {

    /**
     * id
     */
    @ApiModelProperty(value = "主键ID")
    private Long id;

    /**
     * 活动优惠券ID
     */
    @ApiModelProperty(value = "活动优惠券ID")
    private Long activityCouponsId;

    /**
     * 优惠券名称
     */
    @ApiModelProperty(value = "优惠券名称")
    private String title;

    /**
     * 券类型
     */
    @ApiModelProperty(value = "券类型")
    private CouponsTypeEnum couponsType;

    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    /**
     * 用户手机号
     */
    @ApiModelProperty(value = "用户手机号")
    private String userTel;

    /**
     * 消费金额
     */
    @ApiModelProperty(value = "消费金额")
    private BigDecimal fullMoney;

    /**
     * 优惠券金额
     */
    @ApiModelProperty(value = "优惠券金额")
    private BigDecimal money;

    /**
     * 优惠券折扣
     */
    @ApiModelProperty(value = "优惠券折扣")
    private BigDecimal proportion;
    /**
     * 券有效时间开始
     */
    @ApiModelProperty(value = "券有效时间开始")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date effectiveTime;

    /**
     * 券有效时间结束
     */
    @ApiModelProperty(value = "券有效时间结束")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expiresIn;

    /**
     * 使用时间
     */
    @ApiModelProperty(value = "使用时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date useTime;

    /**
     * 可用活动商品ID
     */
    @ApiModelProperty(value = "可用活动商品ID")
    private String productIds;

    /**
     * 用户优惠券状态
     */
    @ApiModelProperty(value = "用户优惠券状态")
    private UserCouponsStatusEnum status;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    protected Date createTime;

    public static UserCouponsDTO build(UserCoupons userCoupons){
        UserCouponsDTO userCouponsDTO = new UserCouponsDTO();
        Beans.copyProperties(userCoupons,userCouponsDTO);
        return userCouponsDTO;
    }
}
